1

I have a phone with Android 4.4 kitkat and a 32GB SD card on which I had noticed the .android_secure folder was taking up 1.5GB of storage so I decided to free up some storage. There were apps in the folder that I didn't have installed on my phone anymore so I thought it'd be safe to delete them as they were not used by my phone anymore. Many apps also had their creation and modification dates set to a couple days ago instead of the date they were actually installed which I thought was odd.

I didn't expect anything to go wrong, but after deleting some asec files and putting the sd card back in the phone, I noticed not a single app from my sdcard loaded. I waited a bit but even after it was mounted my apps weren't there. To my horror when I went in settings and looked under the apps, all my apps were gone. I tried recovering the deleted asec files and putting them back but the apps don't appear anymore. Luckily the asec files only contain the apk files of the app, and the data is stored on the phones internal memory right?

How can I get the phone to read the asec files again? Or if I can't get it to load the asec files, can I reinstall the apps and will the data still be kept or is the app data deleted? Lastly I want to know if it's safe to put an sdcard with apps from one phone onto another phone and be able to swap the sd card between the two phones or if that might also cause the phones to reject the asec files?

0

1 Answer 1

1

It took a bit of testing but I found what I was looking for.

I reinstalled some of the apps from apk files I had on my sd card and both surprisingly and unsurprisingly my data is actually still there! Even the installation date of the app is the date still the same as it was before its asec was deleted, I assume the installation dates are then stored in the app database, which is stored as /data/system/packages.xml. This answers the most important question: If you deleted your .android_secure or deleted your .asec files, the app data will likely still just be safe in the phone memory, luckily. For data recovery I would suggest testdisk and photorec or recuva, so if you don't remember what apps you had installed to your sd card you can actually partially recover the asec files and see what apps are deleted and the dates of when they were last edited. The files themselves are hard to recover but the original folder structure can be restored. The reason I think the recovered asec files don't work is they are most likely fragmented files and the recovery tools have a hard time puzzling the pieces of a fragmented asec together as it's encrypted and not a clear structure of data. Reinstalling the app from the same apk you had before pretty much writes the asec identically to how it was before it was deleted.

Asec files keys are stored under /data/misc/systemkeys/AppsOnSD.sks and I assume it's safe to move the sd card between different phones and the apps on sd card should be fine. If you install one app on the same card from different devices it'll store multiple dm-crypt volumes with each device's separate key. I don't know yet why the .asec files appear to be rebuilt or modified sometimes, they seem to have their creation dates all updated at once at a seemingly random dates in groups.

Conclusion: It's no big deal if you delete your .asec files, you can always reinstall the apps from a .apk file and it will create a new one for the app and it leaves the app data untouched after reinstalling. The app data and cache is kept even if the .asec file for it is missing, so also if you want to delete an app, make sure to properly do it from settings because deleting the asec or apk files leaves the app data under the /data/data folder where you can't access it or delete it when you don't have root access.

I couldn't find much useful information about this online so I hope this info helps or teaches someone a bit about how this app2sd works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .