Another way to look at it is if you are using subclassing with Parcelable, you are probably going in the wrong direction. Parcelable is pretty dumb, and doesn't really support subclassing completely. You should always stay with concrete implementations of Parcelable objects that do not make use of subclassing.
At that point you still need to keep in mind what ABI you are actually creating. When you use a Parcelable, the data ABI you are creating is the concrete class name + the implementation of writeToParcel(). That is what is actually going across the wire, and what the two sides need to be compatible with. So you could solve your problem by putting the concrete Parcelable implementation in a static library that both sides like with... but you need to be very, very careful with this because if either side changes that implementation in any way, it will break the communication. 2012/3/21 Kostya Vasilyev <[email protected]> > Are you asking about the security implications of something called > IGNORE_SECURITY? > > What this does is loads code from one application into another app's > process -- that's arbitrary code that the loading application has no > control over. > > There is no finer granularity control like "load only parcelables and > whatever code they reference" (which might pull in more and more code, > making the whole thing moot). > > In short, I wouldn't touch it with a ten foot pole, and would instead > use a combination of basic data types supported by Parcelable "out of > the box". > > Using custom parcelables within the same package is another story, of > course. > > -- K > > 21 марта 2012 г. 22:20 пользователь Franzi Roesner > <[email protected]> написал: > > I figured this out, in case someone else needs this one day. In the > remote > > service, I did: > > > > Context c = createPackageContext("com.my.package", > > Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE); > > bundle.setClassLoader(c.getClassLoader()); > > > > > > However, what are the security implications of this (particularly the > > CONTEXT_IGNORE_SECURITY flag)? > > > > Thanks! > > > > Franzi > > > > > > On Wednesday, March 21, 2012 9:36:19 AM UTC-7, Franzi Roesner wrote: > >> > >> Hi, > >> > >> I'm trying to send a custom Parcelable to another application (in > another > >> process). > >> > >> I have a client and a remote service, as well as an abstract class (say, > >> AbstractCustomParcelable) that I added to the Android framework itself > (for > >> research purposes). The remote service should receive an object from the > >> client that is an instantiation of this abstract class, and then call a > >> method on it. > >> > >> The problem is that if I extend AbstractCustomParcelable in the client > >> (say, MyCustomParcelable) and then pass it to the service (by putting > it in > >> a Bundle with some other stuff and sending it via a Message), I get a > >> ClassNotFoundError in the service: > >> > >> android.os.BadParcelableException: ClassNotFoundException when > >> unmarshalling: com.my.package.Client$MyCustomParcelable > >> > >> I've done some searches and it appears I need to do something with the > >> classloader, but I'm not sure where to set which classloader, and > nothing > >> I've tried has worked so far (e.g., doing > >> setClassLoader(MyCustomParcelable.class.getClassLoader()) on the > Bundle). Is > >> there a way to make this work? > >> > >> > >> Thanks in advance! > >> > >> Franzi > >> > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > > http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

