0

I built AOSP 8.1.0_r60 from source, and launched it as explained at: https://stackoverflow.com/revisions/48310014/9

. build/envsetup.sh
lunch aosp_x86_64-eng
emulator -show-kernel

Then, I've installed an app with adb install and played around with it.

Now, I wanted to restore the system to the initial state, before I had installed the app.

By printing the QEMU command line options and using find in the device, I've noticed that the app was installed inside:

/data

which seems to come from the userdata-qemu.img.qcow2 image:

-drive if=none,index=2,id=userdata,file=/path/to/aosp/8.1.0_r60/out/target/product/generic_x86_64/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576

What is the best way to reset that image to it's original state, before I had installed my app?

I even tried to do a full rebuild:

make

but the app was still present afterwards.

I have learned how to clean up /system quickly with make snod at: How to just build Android system image but I could not find an analogous option for the user image.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985

1 Answers1

0

As explained in this answer, I've noticed that all writable images are qcow2 overlays of the base images.

I could not find a way to restore them through the build system, which would be ideal, but since qcow2 overlays are so simple, it is reasonable to do it manually as a workaround:

rm system-qemu.img.qcow2
qemu-img create -b system-qemu.img -f qcow2 system-qemu.img.qcow2 1T

Note that make snod resets the only the .img file, not the .img.qcow that -writable-system uses.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985