Forcing ROM APK's SO files to extract to /data/data...

828 views
Skip to first unread message

ivan

unread,
May 15, 2012, 2:13:47 PM5/15/12
to android-ndk
I have an APK that is preloaded on ROMs (i.e. placed in /system/app).

The APK contains a third party SO file contained in its /libs/armeabi
directory, that I absolutely need to have unpackaged to /data/data/
<package-name>/libs. -- Please disregard the why?

Normally the PackageManager will not unpackage SO files from APKs
contained in /system/app (to avoid redundancy).

But, is there a way to force the PackageManager to extract SO files,
from APKs in /system/app, to
/data/data/<package-name>/libs ?

David Given

unread,
May 15, 2012, 5:42:02 PM5/15/12
to andro...@googlegroups.com
On 15/05/12 19:13, ivan wrote:
[...]
> The APK contains a third party SO file contained in its /libs/armeabi
> directory, that I absolutely need to have unpackaged to /data/data/
> <package-name>/libs. -- Please disregard the why?
[...]
> But, is there a way to force the PackageManager to extract SO files,
> from APKs in /system/app, to
> /data/data/<package-name>/libs ?

Not that I know of.

But the library you want should be readable on the system *somewhere*.
If it's a ROM app it ought to be in /system/lib, but if all else fails
you could open the apk with java.util.zip.ZipFile and extract it manually.

Once you've got hold of the library it *may* be possible to just dump it
in your application's libs directory (or, preferably, make a symlink to
save space). But you'll need to check whether your app has write access
to its own lib directory.

--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────

│ "Never attribute to malice what can be adequately explained by
│ stupidity." --- Nick Diamos (Hanlon's Razor)

signature.asc

David Turner

unread,
May 15, 2012, 9:14:59 PM5/15/12
to andro...@googlegroups.com
On Tue, May 15, 2012 at 8:13 PM, ivan <ista...@gmail.com> wrote:
I have an APK that is preloaded on ROMs (i.e. placed in /system/app).

The APK contains a third party SO file contained in its /libs/armeabi
directory, that I absolutely need to have unpackaged to /data/data/
<package-name>/libs. -- Please disregard the why?

Since this is not possible, this is a bit like saying "I need to perform time travel - Please disregard the why?" :-)

When bundling an app into a ROM, the Android platform build system will place its shared files under /system/lib directory. This also means that loading the libraries from Java (or for NativeActivities, if any) should work automatically.

When installing an update, the new libraries go to /data/data/<pkgname>/lib/

They are removed when you uninstall the update (and this guarantees that you can still use the prebuilt version under /system after that, i.e. reverting to the default factory image version).
 
Normally the PackageManager will not unpackage SO files from APKs
contained in /system/app (to avoid redundancy).

But, is there a way to force the PackageManager to extract SO files,
from APKs in /system/app, to
/data/data/<package-name>/libs ?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


ivan

unread,
May 16, 2012, 1:09:34 PM5/16/12
to android-ndk
So there's no way to work with the PackageManager to ensure that
the .so file in /system/app/*.apk is moved to /data/data/*/libs ?

On May 15, 7:14 pm, David Turner <di...@android.com> wrote:

David Turner

unread,
May 16, 2012, 1:25:40 PM5/16/12
to andro...@googlegroups.com
On Wed, May 16, 2012 at 7:09 PM, ivan <ista...@gmail.com> wrote:
So there's no way to work with the PackageManager to ensure that
the .so file in /system/app/*.apk is moved to /data/data/*/libs ?

No, it's not possible.
Reply all
Reply to author
Forward
0 new messages