flatpak: Ensure refining the metadata of apps is not skipped incorrectly
When refining the metadata of apps, it was using the SANDBOXED quirk in order to skip having to refine it a second time (since it involves IO). However, that quirk was being set earlier in the function that also sets the runtime for the app; as a result, when refining updatable apps' metadata in order to ensure that their runtime is set, if there was a previous call to the refine which wasn't yet finished, it could end up skipping the second call before the runtime was set.
This caused a noticeable problem in the Updates page, where the number updates would vary on every start up (but this is likely not the only problem).
This patch simply sets the SANDBOXED quirk after everything is done in the refine, thus allowing it to be correctly used as flag for skipping further calls to the function.
Patch originally by @jrocha; I’m just upstreaming it with a slightly tweaked commit message.