Can I (As an AOSP builder) pre install some apps so after burning on device, they can easily be uninstalled (like regular downloaded apps)?
I am already familiar with system apps and priv-apps but as they lie in system partition they can not be removed! (only disabled in settings menu)
P.S. I know huawei for example uses /system/delapp to install such apps. But I seek for a general way or for AMLogic platform specifically which I am working on!
You can do that by configuring your build to produce a
userdata.img
file with your app(s) included, which you can then flash withfastboot flash userdata
.The
Android.mk
file for these apps that go inuserdata.img
roughly looks like the following:And add the apps to product packages in
device.mk
:You should be able to find plenty of examples on GitHub, e.g., https://github.com/search?l=Makefile&q=TARGET_OUT_DATA+BUILD_PREBUILT&type=Code
Since you are building the image from scratch, you can put your apps in a custom directory under and package a script to install them on boot time if they are not already installed. You can invoke that script by editing the
init.rc
file as follows:The installer script can be as simple as: