8 Commits

Author SHA1 Message Date
Adam Lesinski
d00bb5edcf Load shared library dependencies for AppWidgets
PackageManager and AppWidgetHostServiceImpl should
be loading the resources of any shared libraries being
used by the app, as they have references in their Widgets
or application icons/labels, etc.

Bug:17668152
Change-Id: I359662334edb125d7570089916727df4eeba02bb
2014-10-07 12:14:45 -07:00
Adam Powell
908c748096 Revert "Fix issue with using locally defined attrs in a shared lib"
This reverts commit 5069dd69898bd0d9c69ba2bbd37239ec8d1c9dc6.

The reverted commit caused issues loading resources supplied by static libraries.

Bug 17748356

Change-Id: I860a4f31451ee7c03c02974826472a67226b029f
2014-10-01 18:11:18 +00:00
Adam Lesinski
5069dd6989 Fix issue with using locally defined attrs in a shared lib
The attribute name resource IDs were never fixed up with
the runtime package ID so we weren't finding attributes
whenever the runtime package ID was different than the build
time one, which happened to be when a shared lib referenced itself
(0x00 vs 0x02).

Bug:17666947
Change-Id: Icf3e874bcea0e27eebe42d60fbed626a34bf9266
2014-09-30 16:18:09 -07:00
Adam Lesinski
63e646eed5 Add shared library support to aapt dump
AAPT dump should be able to handle dynamic references
that often come with shared library resources.

Bug:16678251
Change-Id: I6c8cd943145aab20ca9db9694c8c433b3c64279b
2014-07-30 21:53:48 +00:00
Adam Lesinski
b0569b98d5 Use new build var to depend on an APKs resources
Some other projects use LOCAL_APK_LIBRARIES and don't yet
work with the new shared library changes.

Change-Id: Ibb54bc1b5e3eb1252cf5b4e45249b089d25854ac
2014-03-25 17:04:56 -07:00
Adam Lesinski
de898ff429 Shared library resource support
Shared libraries can now export resources for applications
to use.

Exporting resources works the same way the framework exports
resources, by defining the public symbols in res/values/public.xml.

Building a shared library requires aapt to be invoked with the
--shared-lib option. Shared libraries will be assigned a package
ID of 0x00 at build-time. At runtime, all loaded shared libraries
will be assigned a new package ID.

Currently, shared libraries should not import other shared libraries,
as those dependencies will not be loaded at runtime.

At runtime, reflection is used to update the package ID of resource
symbols in the shared library's R class file. The package name of
the R class file is assumed to be the same as the shared library's
package name declared in its manifest. This will be customizable in
a future commit.

See /tests/SharedLibrary/ for examples of a shared library and its
client.

Bug:12724178
Change-Id: I60c0cb8ab87849f8f8a1a13431562fe8603020a7
2014-03-25 12:09:56 -07:00
Dianne Hackborn
ce5abb0a55 Improve/flesh-out shared library version check.
Change-Id: I3d6eb19c8aeaae07a6d17de81ac707c7741608fb
2013-03-15 11:37:01 -07:00
Dianne Hackborn
c895be7bc6 Implement limited shared libraries in apks.
You can now declare shared libraries in apks that are
on the system image.  This is like the existing mechanism
of using raw jar files as shared libraries, but since they
are contained in an apk the library can actually be updated
from the Play Store.  And this even (mostly) works.

There are some deliberate limitations on this feature.  A
new shared library *must* be declared by an apk on the system
image.  Installing an update to a system image apk does not
allow you to add new shared libraries; they must be defined
by everything on the base system image.  This allows us to
get rid of a lot of ugly edge cases (shared libraries that were
there disappearing after an update is uninstalled for example)
and give some brakes on apps that happen to be pre-installed
on devices from being able to throw in new shared libraries
after the fact.

In working on this, I ran into a recently introduced bug where
uninstalling updated to system apps would fail.  This was done
to allow for the new restricted users that don't have all
system apps, but conflicts with the existing semantics for
uninstalling system apps.  To fix this I added a new uninstall
flag that lets you switch on the new mode if desired.

Also to implement the desired logic for limitations on declaring
new shared libraries in app updates, I needed to slightly tweak
the initial boot to keep the Package object for hidden system
packages associated with their PackageSetting, so we can look at
it to determine which shared libraries are allowed.  I think
this is probably more right than it was before -- we already
need to parse the package anyway, so we have it, and when you
install an update to a system app we are in this same state
until you reboot anyway.

And having this fixed also allowed me to fix another bug where
we wouldn't grant a new permission to an updated app if its
system image version is updated to request the permission but
its version is still older than whatever is currently installed
as an update.  So that's good.

Also add new sample code showing the implementation of an apk
shared library and a client app using it.

Change-Id: I8ccca8f3c3bffd036c5968e22bd7f8a73e69be22
2013-03-12 12:51:38 -07:00