There are thousands and thousands of articles online detailing how to set the default install location for apps to external storage, but not a single one for the reverse.
I have an external SD card. I want the contents of that SD card encrypted, by Android itself, in an official, supported fashion that won't suddenly be removed down the road, and in a fashion non-root apps can access. As someone who doesn't run a stock Samsung ROM, adoptable storage is therefore my one and only option. And based on my research, I was completely fine with that. Then I took the plunge and found a nasty surprise.
I can't afford for my phone to be any slower than it already is, so I don't want apps -- any app, ever -- to install to external storage. Unfortunately, when adoptable storage is enabled, sometimes apps install to external storage, and sometimes apps install to internal storage. I've seen all sorts of theories online as to why Package Installer does what it does, but in practice, I can't fathom any rhyme or reason. Even when installing and uninstalling the same APK over and over, sometimes it goes to external, sometimes it goes to internal. It doesn't make sense.
Symlinks, bind mounts, and removing permissions from the external storage
user directories may work, but almost certainly come with caveats I won't notice until my filesystem is an irreparable wreck. I don't want to rely on third-party apps or Magisk/Xposed modules that will inevitably be abandoned, leaving me forever stuck on my current version of Android, praying a new solution comes along.
pm set-install-location 1, which is supposed to do exactly what I want and force installation to internal storage, has no effect whatsoever.
Is there any non-fragile method of ensuring apps always install to internal storage when adoptable storage is enabled? Presumably
pm set-install-location 1 is the solution, but has anyone found the key to actually getting it to work as advertised?