The steps to replicate the crash are very complex and can't provide the full source code. I hope that is related to admob leaking Activity and fixing that will fix also the crash.
Theoretically these are the steps:
1.) You need one of the devices that are prone to this crash. (I use Asus Zenpad C 7.0. Most devices won't crash. It seems that it happens only in Android 5 or 5.1)
2.) Load an interstitial video ad(This can be from any advertiser Facebook, moub... And it must be video otherwise there will be no crash later.)
3.) In another Activity load an admob Interstitial ad (The test ad is good enough. This must be admob otherwise there will be no crash later)
4.) At this point my app does some video decoding in background (Nothing is shown on the screen) and at some point the logcat is becoming red while the app is working fine.
I get stuff like:
E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -
2147483646E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!
E/[EGL-ERROR]: void __egl_platform_dequeue_buffer(egl_surface*):1609: failed to dequeue buffer from native window 0x56c8a008;
5.) Later in my app if I attempt to show any other Activity, the app crashes. The crash is dependent on what Activity I show and usually it is android.os.TransactionTooLargeException or java.lang.IllegalStateException
For example if I attempt to show the Interstitial admob ad that was already loaded the crash is:
java.lang.RuntimeException: Unable to start activity ComponentInfo{.../com.google.android.gms.ads.AdActivity}: java.lang.IllegalStateException: Flags.initialize() was not called!
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2702)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Caused by: java.lang.IllegalStateException: Flags.initialize() was not called!
at com.google.android.gms.internal.ahi.a(Unknown Source)
at com.google.android.gms.ads.internal.overlay.ag.g(Unknown Source)
at com.google.android.gms.ads.AdActivity.onStart(Unknown Source)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)