Revert "Remove old and duplicated logic in picking up the best artifact."

This reverts commit 4f6801ea633f9d94945bcedb8a1db79be6cec10b.

Reason for revert: has issues and probably caused app startup regression.

Bug: 308248092
Change-Id: I5b6f1c933ffa5912fa8b96826fde79ff544680f9
3 files changed