Situation. I have a
.img disk image file obtained from a
.vmdk file via a virtualbox conversion, the latter being created by an Android 4.4.2 emulator. I'm trying to recover some app data and transfer it to a new, working, .img file.
What I did. I extracted APKs and copied app data folders (com.devname.appname) from/to the
/data/data directory. I did that using a file manager and via Ubuntu terminal. I also attempted to copy the folders to
cp -ar retains files permissions and ownership, that was of no use after the import into the working image.
The problem (and a workaround). When the APKs are installed, a new uid (in the 10000 group) is generated for them. These values are unknown when I import the data folders, hence they are destroyed at phone boot. A log in
/data/system/uiderrors.txt confirms this. The only way I could make it work was to install the APK, run the app so that the new data folders are created with a proper uid, replace those folders with old ones and fix ownership and permissions accordingly (for every app). This turned out to be effective, but it's a very tedious and error-prone process.
Is there a proper way to achieve this result?
- Folders are copied after the APK is installed. The APK won't install if folders are there already.
- Original image has some Android data corrupted, so it cannot be mounted in the emulator.
loop mountworks properly, though.
- I didn't modify
packages.xmlfiles (should I?).