Applications on Android devices use both APK and AAB file formats. This file is then published in the app store to allow users to download and install. For applications that are already installed in the device, these APK files can still be obtained using file sharing applications as they are simply hidden in the system.
In the APK it has various codes to keep the application running smoothly. For device manufacturers there are unique applications because the code they use is exclusively their build and can only be run on their devices.
Xiaomi engineers have recently suggested to Google to include the code in AOSP, in order to prevent users from downloading or extracting APK files from devices. This is because some APK files have custom source code. By preventing this APK file from being extracted, it cannot be shared or allow users to modify the application.
But Xiaomi's proposal was rejected by Google, because APK files are not categorized as private files or secret files. Plus a Google representative, no one wants this done. If it is implemented as well, there is no guarantee from Google that this APK file will remain safe and private.