How is the default launcher set after a factory reset I would like to know how is the default launcher set after a factory reset. What files are in charge of telling the OS, for example, that the Touchwiz app is the default launcher for Samsung devices.

I do not want to replace the launcher, that is something I already know how to do. This is a very specific question regarding how the os works. I am interested in doing a system update via recovery and changing the files that tell the OS which app is the default launcher, in order to tell it that my newly flashed app (flashed in system partition) is.

I look forward to your response. Thanks in advance.

EDIT:

As stated, Samsung is just a given example but it is one of an endless list. This is an os general-behaviour related question not manufacturer specific.
If a ROM has multiple launchers, and one is not set by default in the default factory configuration, then after the Setup Wizard completes and the device attempts to go to the desktop, a pop-up appears asking you to select the Home application and it will give you an option to "Always do this".

You can select a launcher here, but until you select "Always do this" (or similar text) this pop-up selection window will appear every time the Home button is pressed.

This is common in custom ROMs which have multiple launchers pre-installed.