Wednesday, September 25, 2019

app2sd - How to move apps from internal to external storage?


I'm trying to move with Lucky Patcher (also with app2sd and Samsung stock app) some apps from internal to external storage, but everytime with every apps movable I got this message:


java.lang.IllegalArgumentException: New installs into ASEC containers no longer supported


I have a Samsung Galaxy S7 with Android 8.0 and root.


Do you now why this happens? Maybe, Android 8.0 doesn't allow anymore this?



Answer



Up to Lollipop, native app2sd moved .apk files as encrypted .asec files (1) to .android_secure folder in /mnt/sdcard/ or /storage/sdcard[0|1]/. On every boot these encrypted files were decrypted and placed in a temporary filesystem mounted at /mnt/asec/ (2) by vold, to which the symlinks from app directories in /data/app/ and possibly from library directories in /data/data/ were pointing.


Starting with Marshmallow, the native method of moving apps to external SD card works only if SD card is formatted as Adoptable Storage (3, 4):



ASEC containers have been deprecated since MNC, which is when we introduced the "adoptable storage" feature. Adoptable storage is a much better user experience, since we move both the APK and private app data together as a single unit.



* MNC is Macadamia Nut Cookie; code name for Android Marshmallow (6.x).

And:



new installs into ASEC containers are no longer supported; use adoptable storage instead.



Adoptable Storage is a Full Disk Encrypted SD card, completely managed by vold, not visible to user as external SD card. See here how it differs from traditional Portable Storage. You can format SD card as partially Adoptable and partially Portable too.


Like the pre-Marshmallow app2sd phenomenon (5), apps only with installLocation set to preferExternal or auto in app's manifest are moveable:



Apps can be placed on adopted storage media only when the developer has indicated support through the android:installLocation attribute.



For apps with install location auto, default install location (set using pm set-install-location) decides where app will be installed. See this answer for details.



If you want to move all apps, use a third party solution like Apps2SD or Link2SD.


PS:
An even better approach is to move /data/media instead of apps. Create an extra partition on external SD card and on post-fs-data mount it to /data/media using an init.d script or Android's init service. Other bigger directories /data/app or /data/data can also be moved in the same way.


If you want to keep files encrypted on external SD card, this can be achieved through native methods dm-crypt (Android's FDE) for block device encryption, ecryptfs for stacked filesystem encryption, or third party solution like EncFS for stacked encryption. New native method of filesystem encryption fscrypt (Android's FBE) may also work, but I haven't tried. See details in this answer.




RELATED:



No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...