1

In ART environment, it fails to pass complex Parcelable object.

There is the case that calling the CREATOR of another class in the call from the internal processing of Parcel of CREATOR of inner class of a class that implements the Parcelable. That it would have taken the field of different classes of reflection is when reading class Parcelable inside the Parcel is due.

for example:

  • ListParamDto.java implements Parcelable.
  • DetailParamDto.java extends ListParamDto.java
  • intent.putExtra(detailParamDto.getClass().getCanonicalName(), DetailParamDto) and startActivity(intent).

Of 2133, around line API 19 Parcel.java https://github.com/android/platform_frameworks_base/blob/master/core/java/android/os/Parcel.java#L2139

Class c = loader == null ? Class.forName(name) : Class.forName(name, true, loader); // name's value is DetailParamDto
Field f = c.getField("CREATOR"); //f indicates the field of DetailParamDto
creator = (Parcelable.Creator)f.get(null); // ←result of get, the value that is set to creator becomes the RentListParamDto $ CREATOR

it is going well in Dalvik environment.

I have attached the stacktrace log,

05-27 04:22:39.203    2254-2254/jp.co.xxxx.android.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: jp.co.xxx.android.app, PID: 2254
    java.lang.RuntimeException: Unable to start activity ComponentInfo{jp.co.xxx.android.app/jp.co.xxx.android.app.activity.buy.BuylActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@64ea3a48: Unmarshalling unknown type code 3276852 at offset 2512
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)s
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
     Caused by: java.lang.RuntimeException: Parcel android.os.Parcel@64ea3a48: Unmarshalling unknown type code 3276852 at offset 2512
            at android.os.Parcel.readValue(Parcel.java:2080)
            at android.os.Parcel.readArrayMapInternal(Parcel.java:2313)
            at android.os.Bundle.unparcel(Bundle.java:249)
            at android.os.Bundle.getBoolean(Bundle.java:858)
            at android.content.Intent.getBooleanExtra(Intent.java:4490)
            at jp.co.xxx.android.app.activity.BaseActivity.onCreate(BaseActivity.java:98)
            at jp.co.xxx.android.app.activity.buy.DetailBaseActivity.onCreate(DetailBaseActivity.java:126)
            at android.app.Activity.performCreate(Activity.java:5231)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)

Do you know of it?

Charles
  • 50,943
  • 13
  • 104
  • 142
  • This is very difficult to understand. Some cleanup of the grammar would help a lot. – bcr May 28 '14 at 01:06
  • I see this bug in b.android.com. You may want to add a small sample project with instructions on how the repeat the error. – Morrison Chang May 28 '14 at 01:55
  • @MorrisonChang Thanks, I would like to do so, but reproduction condition is not known…Even in the same objectstructure, there is a case to go well. – Shintaro Katafuchi May 28 '14 at 03:41
  • Are you sure you didn't just call getBooleanExtra() where it should have been getParcelableExtra? – Greg Giacovelli May 28 '14 at 04:12
  • @GregGiacovelli I think that it is not doing. Because it is because it worked well in Dailvik environment. – Shintaro Katafuchi Jun 02 '14 at 03:14
  • I mean the stack pretty much states that getBoolean is where the call fails. Is it possible that Dalvik was just defaulting to false and your code has always been incorrect? Sorry just going by the stack. This doesn't seem like it would be an Art issue. – Greg Giacovelli Jun 02 '14 at 05:32
  • Also the reference to line 2139 is the wrong version of Android, it's not correct method name. You want the readArrayMapInternalMethod, this method actually opens up the parcelable and reads the names tagged in the Parcel and runs through the unmarshalling code – Greg Giacovelli Jun 03 '14 at 07:11

0 Answers0