[Q] System/app apk vs installed apk - Android Software/Hacking General [Developers Only]

Hi,
I am trying to build my own custom ROM(JellyBean) and observed that any apk that is placed in the /system/app(adb push somefile.apk /system/app) folder gets a corresponding .dex file in the /cache/dalvik-cache. But when I install this apk using "adb install some.apk", an entry in the /data/app folder gets added with the corresponding package name.
1) If an apk is pushed in the /system/app folder is it being cached for some performance benefit? Will there also be some part of this apk residing in the RAM after it is pushed?
2) Will this .dex file in the dalvik-cache folder ever get deleted?
3) Does installing an app(and not running it) still cause some memory to be occupied in the RAM/Cache? I have observed that installing around 120 apps on my device causes it to be less responsive.
I have tried to find a thread with these questions but not much luck. Any insights would be appreciated.
Thanks!!

.dex still exists after a cache wipe
I did a dalvik cache wipe and after a reboot this .dex is recreated. Looks like this .dex will never be deleted.

Related

[SOLVED][Q] Install titanium in /data or /system

I created a flashab;e zip or flashing TB after a fresh install.
There are two options to create ZIP to install TB as user or system app.
I see that there is an additional file in the flashable zip when i select to install it as a system app.
/system/lib/libtitanium.so
My question is
What is the diffeence between installing tB as user/system and whats the use of the additional .so file.
.so library is a native compiled (binary) library. What is it used for? I don't know, some faster functions of Titanium. Why is it in one ZIP and not it another? Because user .apk has its libs included and they're unpacked by system automatically into its own /data/data/<appname>/lib directory, while system app is expected to have its libs with the rest of system libs, and it doesn't unpack anything.
When the app is installed in /system, it doesn't take place in /data, and (AFAIK) it automatically inherits system permissions. That's about the only difference I'm aware of.
Jack_R1 said:
.so library is a native compiled (binary) library. What is it used for? I don't know, some faster functions of Titanium. Why is it in one ZIP and not it another? Because user .apk has its libs included and they're unpacked by system automatically into its own /data/data/<appname>/lib directory, while system app is expected to have its libs with the rest of system libs, and it doesn't unpack anything.
When the app is installed in /system, it doesn't take place in /data, and (AFAIK) it automatically inherits system permissions. That's about the only difference I'm aware of.
Click to expand...
Click to collapse
Bang on, thanks
Sent from a Desire S waiting for Kernel 3. WAKE UP HTC!!!!

[GUIDE] Merging updated system apps with old one, GET MORE FREE MEMORY!!

(Preface for noobs : /system and /data are two different partitions. Freeying up /system won't get you more intrenal memory, but /data does. Old apks rest in /system and updated versions placed in /data. You can replace the old apks using newer versions)
I heared Titanium Backup PRO does something like, but you can do this with any File Explorer with ROOT access. Its works 100% for Android Gingerbread 2.3.x , try on other versions.
### Do it on your own risk, I am not responsible for anything ###
1. Update the desired app to the latest version from Google Play Store
2. Open File Manager, Enable ROOT_ACCESS, remount /System as writable
3. Goto /system/app and backup the desired apk to sdcard
4. Goto /data/app and copy updated apk
5. Paste into /System/app
6. Note down the filename of old apk and delete the old apk
7. Rename the new apk into the old filename
8. You may encounter a FORCE CLOSE if the app was running in background
9. The updated apk in /data/app will be removed automatically
10.Restart your device, Done!
I replaced Playstore, Maps, Google Search ect..
Example: For PlayStore, updated apk will be com.android.vending-1.apk, and old apk is vending.apk
Hit thanks it it works, Thanks
thanks, nice guide! All is ok (PlayStore, Terminal Emulator), but if I merge last version of "Google Play Service", then Gmail or Maps shows the message "Unknown issue with Google Play services" when I open them... do you know how to solve? thanks in advance
p.s. configuration in signature
Better use Link2SD. It makes the integration of updates into system seamless. Rebooting the device is optional (restart only if you encounter errors).
thank you for your suggestion! I tried TitaniumBackup but it gives me the same error, then now I'm trying with Link2sd and it works well, BUT the new apk file is in system/app instead of system/priv-app, and its name is "com.google.android.gms-1.apk" instead of "PrebuiltGmsCore.apk"... can this create some problems in future?
EDIT: I tried moving to the priv-app folder and renaming the apk to be identical as before and it seems to work... for now...
It's the package name, it won't create any problems. There is no need to rename the app to match the old one. Default location when converting to system app is in /system/app. I don't know if you can change the location, but you can move it manually to /system/priv-app thru root explorer. Just restart the device afterwards to eliminate FC errors.

[Tutorial] Install problematic APKs in /system (or /preload)

You may have tried to move some APKs to /system/app/ and end up with continuous crashes, usually resulting in abandoning your plan to save some otherwise wasted space (or preventing to accidentally uninstall all keyboards...)
This is often said to be a permissions issue, yet that's not enough for some packages: those with external libraries.
Copy the APK to /system/app/, then `chmod 644` it as usual.
You can also install to /preload and symlink to system
On your computer (easier but not required), open the APK (as a renamed ZIP).
Go to ./lib/{architecture}/, where on the Ace2 this is lib/armeabi-v7a.
Extract all the (.so) files here and put them in /system/lib.
There's no step 5!
Ryccardo said:
You may have tried to move some APKs to /system/app/ and end up with continuous crashes, usually resulting in abandoning your plan to save some otherwise wasted space (or preventing to accidentally uninstall all keyboards...)
This is often said to be a permissions issue, yet that's not enough for some packages: those with external libraries.
Copy the APK to /system/app/, then `chmod 644` it as usual.
You can also install to /preload and symlink to system
On your computer (easier but not required), open the APK (as a renamed ZIP).
Go to ./lib/{architecture}/, where on the Ace2 this is lib/armeabi-v7a.
Extract all the (.so) files here and put them in /system/lib.
There's no step 5!
Click to expand...
Click to collapse
Thank you very much :good:
All of the above is still true if you want to package apps in CWM format, but people who just are tight on /data (and don't want to repartition) can just use the convert to system app in Link2SD, which now actually works on apps with libraries

[Completed] [Q] APK rebuild and install issues

I am learning how to mod Android apps.
I have rooted ASUS Transformer Prime for my experiments. It has busybox installed.
I have downloaded one of the games from /data/app directory, by copying it to sdcard and then using adb pull.
Then I have used apktool to disassemble apk and without any changes assembling it back. I did verify with Beyound Compare tool that resulting apk logically is same to original. All files inside are byte to byte same.
I ran zipalign on it.
Then I pushed it back to my device via adb push to sdcard and then copy it to /dev/app folder. restored permissions and owner.
When I tried to run the app I got the error, "Unfortunately application stopped".
The only difference between original and disassembled apk that I can see is that files inside the apk (which is zip) are in different order.
Can anyone shed the light on this problem? Does Android somehow remembered offsets of different files in that apk? Is there any log somewhere?
Thank you very much.
vasiliy_gagin said:
I am learning how to mod Android apps.
I have rooted ASUS Transformer Prime for my experiments. It has busybox installed.
I have downloaded one of the games from /data/app directory, by copying it to sdcard and then using adb pull.
Then I have used apktool to disassemble apk and without any changes assembling it back. I did verify with Beyound Compare tool that resulting apk logically is same to original. All files inside are byte to byte same.
I ran zipalign on it.
Then I pushed it back to my device via adb push to sdcard and then copy it to /dev/app folder. restored permissions and owner.
When I tried to run the app I got the error, "Unfortunately application stopped".
The only difference between original and disassembled apk that I can see is that files inside the apk (which is zip) are in different order.
Can anyone shed the light on this problem? Does Android somehow remembered offsets of different files in that apk? Is there any log somewhere?
Thank you very much.
Click to expand...
Click to collapse
Learned to use adb logcat.
Apparently app was failing because dalvik detected that timestamp on a dex file is different and decided that it should replace cached file in /data/dalvik-cache.
But that file is not writable for a group. Not sure why.

Android App use without installation

Hello
So far from my tinkering i have came to realize that after an android app gets installed the following directory under the root file system gets changed
/data/app : here the apk is stored
/data/app-lib : here the app's native binaries are extracted
/data/dalvik-cache : here the app's dex binary is extracted
/data/data : here the app's db & other files are created under a folder named by the app's package
i rooted my nexus 5
i then installed a simple app
checked the directories mentioned above and saw new contents
then i copied the particular app's contents from the mentioned directories and kept them in a separate folder inside the sdcard directory
i then uninstalled the app & checked the above directories. The files corresponding to the app were gone as per my guess
Then i have copied back the contents from my sdcard to the above directories to restore the app without a new installation
But Now the Android OS is not showing the APP along with the others , but WHY ? Does the OS creates a tree somewhere in the filesystem during the installation ? or If there is some thing else which i am missing which i can change so that the app reappears automatically without any new installation .
Thanks in advance
i have solved the problem .. after reset the app was automatically got by the OS , because the installd daemon starts with boot

Categories

Resources