On Tue, May 29, 2012 at 1:19 AM, TreKing <treking...@gmail.com> wrote:
> On Mon, May 28, 2012 at 3:10 PM, Latimerius <l4t1m3r...@googlemail.com>
> wrote:
>>
>> Say package A gets a package B's Context by calling
>>
>> Context pkgBctx = createPackageContext ("B", 0);
>
>
> Read the summary for that method.

Cheers for the hint but I know that by heart by now. ;-)

> This is not "getting" package B's Context.
> This is creating a Context that refers to that package. Context is an
> abstract concept, not some physical thing that is sitting around being
> shared.

First of all, the docs say "Context objects are not shared, however
they share common state (Resources, ClassLoader, etc)".  The way I
read this is that the important parts of Context *are* shared even
though the Context itself (likely mostly an empty shell, a collection
of references) is not.

But more importantly and more to the point, the package B *itself*,
its files, *is* a physical thing sitting around being shared.  I'm not
interested in the B's Context instance as such that A holds, I'm
wondering how come it allows A to access B which is uninstalled by
then.

> So you basically have an object that has some in-memory state
> information it obtained from B. If B goes away after it's created shouldn't
> matter as it's just the source for your local Context instance.

Sorry, I should have been more specific as to what I meant saying A is
able to use B through B's Context after B has been uninstalled.
You're right and I understand that things like getPackageName() or
getExternalCacheDirectory() will continue to work as those are not
much more than a bunch of values stored in the instance somewhere.
However the puzzling part is that A seems to be able to access (read
and use) *files* in B's assets/ directory.  If B's gone those should
be gone too - right?

Thanks for your help!

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

Reply via email to