• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Mod a mod to add custom apks preinstalled?

droidzone

Android Enthusiast
Sep 24, 2010
436
58
India
Hi..

I've had problems with Gmail and Maps applications previously with Neophyte ROMs. In that case one of the solutions was removing the apks for these apps from with the /system/app folder of the ROM zip.

My question is:
Is it possible to add our own apks to the custom ROM so that these apks come preinstalled on the ROM when someone flashes it..in a manner, a kind of 2nd generation mod?

Is it possible to add our own system variables and settings files so that the ROM autoinstalls it on First Install? In particular, I'd like to preset my own APN file for the network.
 
It may well be a case of having to recompile the rom... Could be a lot of work.

Was hoping for an easier solution! :)

Defrost now have an additional zip for adding applications after the rom. Might be worth looking into how that works.
I will.

To unravel this, I guess I need a more thorough understanding of the installation process..of how an API call for an installation is handled..what files/file entries are modified etc.
 
Upvote 0
It is an add on, you just flash it via defrost setup or clockworkmod
Script is Meta-Inf\com\google\android\update-script Where did you get "show progress"?

Sorry, that was the code inside the script(update-script).

Code:
show_progress 0.1 0
  copy_dir PACKAGE:system SYSTEM:
  show_progress 0.2 10


Guess the script does what it says,Copy the included files to update the system according to the directory structure inside the zip. Simple and effective I guess. Wonder if it's a defrost feature or common to Android.
 
Upvote 0
Tried it out on AuraxTsense..Piece of cake..Removed all the apps from the zip from /system/app, added 11 of my own, and flash updated in recovery.

On reboot, 9 of 11 apps were installed. 2 failed, though it is possible that they were incompatible with Froyo even from start. Next, to try flashing without the Google certificates and with a skeletal framework just including the apks and paths.
 
  • Like
Reactions: SUroot
Upvote 0
Isn't it? There were a few posts in Xda on this in the past. Found it just now that I have a clearer picture of what I'm searching for. Used the script file as the search term and look what it turned up..

Check this out:
[Courtesy: www.robmcghee.com]

Creating an update.zip package is quite easy in fact. For example, to add a (valid) test.apk package to your rom:
- create an empty folder <workdir>
- create folder structure for test.apk (<workdir>/system/app) and copy the test.apk
- create folder structure for update-script (<workdir>/META-INF/com/google/android)
- edit <workdir>/META-INF/com/google/android/update-script
- put in it:

show_progress 0.1 0

copy_dir PACKAGE:system SYSTEM:
set_perm_recursive 0 0 0755 0644 SYSTEM:app
show_progress 0.1 10


- compress the <workdir> content to zip (not the <workdir> folder itself)
Now you are going to sign the zip file. Download testsign.zip and copy it in your <SDK>/tools folder. Extract it here. It should create a sign subfolder with a testsign.jar file in it.
Then in the command prompt/terminal, from <workdir> folder, do:

java -classpath <SDK>/tools/sign/testsign.jar" testsign file.zip file-signed.zip

Ok, now your zip file is ready to be deployed using the &#8220;Flash zip from sdcard&#8221; option in a recovery image.
I played around the file a bit before finding this post. But I've found that the signing is not really necessary. I've toggled off my signature verification, so that's probably why I didnt need it. But if signature is included, apparently any apk can be installed! :)

Edit: There's no need to manually sign each time. If the apks are just added to the file you found, they will install. I've uploaded it for future reference.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones