Project: titanium
Issue TIMOB-17477: Android 5.0: KS->Photo Gallery crashes 
Build KS with android-L. Go to Phone->Photo Gallery. 1. On emulator, the app crashes with log {code} E/art (15583): JNI ERROR (app bug): attempt to pass an instance of java.util.HashMap as argument 1 to void ti.modules.titanium.media.MediaModule.openPhotoGallery(org.appcelerator.kroll.KrollDict) I/am_on_resume_called(15583): [0,org.appcelerator.titanium.TiActivity] W/EGL_emulation(15583): eglSurfaceAttrib not implemented W/CanvasContext(15583): Failed to set EGL_SWAP_BEHAVIOR on surface 0xb8e20740, error=EGL_SUCCESS D/TiCompositeLayout(15583): (main) [606,238323] org.appcelerator.titanium.view.TiCompositeLayout {0,0,1080,1557} D/TiCompositeLayout(15583): (main) [1,238324] ti.modules.titanium.ui.widget.TiImageView {30,60,630,660} D/TiCompositeLayout(15583): (main) [152,238476] org.appcelerator.titanium.view.TiCompositeLayout {0,0,1080,1557} D/TiCompositeLayout(15583): (main) [1,238477] ti.modules.titanium.ui.widget.TiImageView {30,60,630,660} F/art (15583): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: bad arguments passed to void ti.modules.titanium.media.MediaModule.openPhotoGallery(org.appcelerator.kroll.KrollDict) (see above for details) F/art (15583): art/runtime/check_jni.cc:65] from boolean org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(long, java.lang.Object, long, java.lang.String, java.lang.Object, boolean, boolean, int, java.lang.String) F/art (15583): art/runtime/check_jni.cc:65] "KrollRuntimeThread" prio=5 tid=11 Runnable F/art (15583): art/runtime/check_jni.cc:65] | group="main" sCount=0 dsCount=0 obj=0x7901f0a0 self=0xb8ddae30 F/art (15583): art/runtime/check_jni.cc:65] | sysTid=15623 nice=0 cgrp=default sched=0/0 handle=0xb8c7fa10 F/art (15583): art/runtime/check_jni.cc:65] | state=R schedstat=( 0 0 0 ) utm=404 stm=37 core=0 HZ=100 F/art (15583): art/runtime/check_jni.cc:65] | stack=0xa6c79000-0xa6c7f000 stackSize=1064KB F/art (15583): art/runtime/check_jni.cc:65] native: #00 pc 00005baf /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+95) F/art (15583): art/runtime/check_jni.cc:65] native: #01 pc 00002751 /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+33) F/art (15583): art/runtime/check_jni.cc:65] native: #02 pc 003ba727 /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream >&, int, char const*, art::mirror::ArtMethod*)+135) F/art (15583): art/runtime/check_jni.cc:65] native: #03 pc 0038bc10 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream >&) const+272) F/art (15583): art/runtime/check_jni.cc:65] native: #04 pc 00129a18 /system/lib/libart.so (art::JniAbort(char const*, char const)+952) F/art (15583): art/runtime/check_jni.cc:65] native: #05 pc 0012aa1c /system/lib/libart.so (art::JniAbortF(char const*, char const, ellipsis)+108) F/art (15583): art/runtime/check_jni.cc:65] native: #06 pc 0008412b /system/lib/libart.so (art::CheckMethodArguments(art::mirror::ArtMethod*, unsigned int*)+844) F/art (15583): art/runtime/check_jni.cc:65] native: #07 pc 0036c1fb /system/lib/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, art::mirror::Object*, _jmethodID*, jvalue*)+1147) F/art (15583): art/runtime/check_jni.cc:65] native: #08 pc 002d11fe /system/lib/libart.so (art::JNI::CallVoidMethodA(_JNIEnv*, _jobject*, _jmethodID*, jvalue*)+334) F/art (15583): art/runtime/check_jni.cc:65] native: #09 pc 0013aeff /system/lib/libart.so (art::CheckJNI::CallVoidMethodA(_JNIEnv*, _jobject*, _jmethodID*, jvalue*)+175) F/art (15583): art/runtime/check_jni.cc:65] native: #10 pc 0016d8f6 /data/app-lib/com.appcelerator.kitchensink-1/libkroll-v8.so (titanium::MediaModule::openPhotoGallery(v8::Arguments const&)+246) F/art (15583): art/runtime/check_jni.cc:65] native: #11 pc 00267dd6 /data/app-lib/com.appcelerator.kitchensink-1/libkroll-v8.so (???) F/art (15583): art/runtime/check_jni.cc:65] at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native method) F/art (15583): art/runtime/check_jni.cc:65] at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) F/art (15583): art/runtime/check_jni.cc:65] at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:884) F/art (15583): art/runtime/check_jni.cc:65] at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1107) F/art (15583): art/runtime/check_jni.cc:65] at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347) F/art (15583): art/runtime/check_jni.cc:65] at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:99) F/art (15583): art/runtime/check_jni.cc:65] at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:409) F/art (15583): art/runtime/check_jni.cc:65] at android.os.Handler.dispatchMessage(Handler.java:98) F/art (15583): art/runtime/check_jni.cc:65] at android.os.Looper.loop(Looper.java:135) F/art (15583): art/runtime/check_jni.cc:65] at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) F/art (15583): art/runtime/check_jni.cc:65] I/am_activity_launch_time( 1280): [0,941708455,com.appcelerator.kitchensink/org.appcelerator.titanium.TiActivity,2879,2879] I/ActivityManager( 1280): Displayed com.appcelerator.kitchensink/org.appcelerator.titanium.TiActivity: +2s879ms I/sf_frame_dur( 942): [com.appcelerator.kitchensink/org.appcelerator.titanium.TiActivity,1,5,3,0,2,2,1] D/TiBaseActivity(15583): (main) [834,239311] Activity org.appcelerator.titanium.TiActivity@2ff04d06 onStop F/libc (15583): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x6e009d in tid 15623 (KrollRuntimeThr) I/DEBUG ( 940): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** I/DEBUG ( 940): Build fingerprint: 'generic_x86/google_sdk_x86/generic_x86:L/LPV81B/1242878:eng/test-keys' I/DEBUG ( 940): Revision: '0' I/DEBUG ( 940): pid: 15583, tid: 15623, name: KrollRuntimeThr >>> com.appcelerator.kitchensink <<< I/DEBUG ( 940): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6e009d I/DEBUG ( 940): Abort message: 'art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: bad arguments passed to void ti.modules.titanium.media.MediaModule.openPhotoGallery(org.appcelerator.kroll.KrollDict) (see above for details)' I/DEBUG ( 940): eax 006e0061 ebx b47b2cf8 ecx a6d801d0 edx e90c383e I/DEBUG ( 940): esi a6d80310 edi b8f4d410 I/DEBUG ( 940): xcs 00000073 xds 0000007b xes 0000007b xfs 00000057 xss 0000007b I/DEBUG ( 940): eip b45c2ce7 ebp a6d801b8 esp a6d8010c flags 00200246 I/DEBUG ( 940): I/DEBUG ( 940): backtrace: I/DEBUG ( 940): #00 pc 0030fce7 /system/lib/libart.so (art::mirror::ArtMethod::IsProxyMethod()+7) I/DEBUG ( 940): #01 pc 00327cbf /system/lib/libart.so (art::Monitor::VisitLocks(art::StackVisitor*, void (*)(art::mirror::Object*, void*), void*)+143) I/DEBUG ( 940): #02 pc 003891a0 /system/lib/libart.so (art::StackDumpVisitor::VisitFrame()+704) I/DEBUG ( 940): #03 pc 0037d79f /system/lib/libart.so (art::StackVisitor::WalkStack(bool)+159) I/DEBUG ( 940): #04 pc 0038bca0 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream >&) const+416) I/DEBUG ( 940): #05 pc 0039767e /system/lib/libart.so (art::ThreadList::DumpLocked(std::__1::basic_ostream >&)+478) I/DEBUG ( 940): #06 pc 0037272a /system/lib/libart.so (_ZN3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE.isra.124+410) I/DEBUG ( 940): #07 pc 003729d1 /system/lib/libart.so (art::Runtime::Abort()+129) I/DEBUG ( 940): #08 pc 00116bbc /system/lib/libart.so (art::LogMessage::~LogMessage()+1644) I/DEBUG ( 940): #09 pc 00129f1d /system/lib/libart.so (art::JniAbort(char const*, char const*)+2237) I/DEBUG ( 940): #10 pc 0012aa1c /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+108) I/DEBUG ( 940): #11 pc 0008412b /system/lib/libart.so (art::CheckMethodArguments(art::mirror::ArtMethod*, unsigned int*)+844) I/DEBUG ( 940): #12 pc 0036c1fb /system/lib/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, art::mirror::Object*, _jmethodID*, jvalue*)+1147) I/DEBUG ( 940): #13 pc 002d11fe /system/lib/libart.so (art::JNI::CallVoidMethodA(_JNIEnv*, _jobject*, _jmethodID*, jvalue*)+334) I/DEBUG ( 940): #14 pc 0013aeff /system/lib/libart.so (art::CheckJNI::CallVoidMethodA(_JNIEnv*, _jobject*, _jmethodID*, jvalue*)+175) I/DEBUG ( 940): #15 pc 0016d8f6 /data/app-lib/com.appcelerator.kitchensink-1/libkroll-v8.so (titanium::MediaModule::openPhotoGallery(v8::Arguments const&)+246) I/DEBUG ( 940): #16 pc 00267dd6 /data/app-lib/com.appcelerator.kitchensink-1/libkroll-v8.so I/DEBUG ( 940): I/DEBUG ( 940): stack: I/DEBUG ( 940): a6d800cc a6d80140 [stack:15623] I/DEBUG ( 940): a6d800d0 a6d8013c [stack:15623] I/DEBUG ( 940): a6d800d4 b596ee18 /system/lib/libc++.so I/DEBUG ( 940): a6d800d8 a6d80110 [stack:15623] I/DEBUG ( 940): a6d800dc b5907a43 /system/lib/libc++.so (std::__1::num_put > >::do_put(std::__1::ostreambuf_iterator >, std::__1::ios_base&, char, long) const+499) I/DEBUG ( 940): a6d800e0 a6d8018c [stack:15623] I/DEBUG ( 940): a6d800e4 b8fcf144 [heap] I/DEBUG ( 940): a6d800e8 a6d80127 [stack:15623] I/DEBUG ( 940): a6d800ec a6d80127 [stack:15623] I/DEBUG ( 940): a6d800f0 a6d8012b [stack:15623] I/DEBUG ( 940): a6d800f4 b8fcf178 [heap] I/DEBUG ( 940): a6d800f8 00000020 I/DEBUG ( 940): a6d800fc b7765fc4 /system/lib/libc.so I/DEBUG ( 940): a6d80100 716542ea /system/framework/x86/boot.oat I/DEBUG ( 940): a6d80104 a6d8013c [stack:15623] I/DEBUG ( 940): a6d80108 b8fcf144 [heap] I/DEBUG ( 940): #00 a6d8010c b45dacc0 /system/lib/libart.so (art::Monitor::VisitLocks(art::StackVisitor*, void (*)(art::mirror::Object*, void*), void*)+144) I/DEBUG ( 940): #01 a6d80110 b8f4d410 [heap] I/DEBUG ( 940): a6d80114 00000000 I/DEBUG ( 940): a6d80118 a6d8012b [stack:15623] I/DEBUG ( 940): a6d8011c a6d80127 [stack:15623] I/DEBUG ( 940): a6d80120 00646c25 I/DEBUG ( 940): a6d80124 316b0000 I/DEBUG ( 940): a6d80128 b7393033 /system/lib/libGLES_trace.so (android::gltrace::GLTrace_glDeleteFramebuffers(int, unsigned int const*)+435) I/DEBUG ( 940): a6d8012c b592113b /system/lib/libc++.so (std::__1::locale::use_facet(std::__1::locale::id&) const+11) I/DEBUG ( 940): a6d80130 b8f01c70 [heap] I/DEBUG ( 940): a6d80134 00000000 I/DEBUG ( 940): a6d80138 00000000 I/DEBUG ( 940): a6d8013c 39303331 I/DEBUG ( 940): a6d80140 b8fcf140 [heap] I/DEBUG ( 940): a6d80144 00000001 I/DEBUG ( 940): a6d80148 a6d801b8 [stack:15623] I/DEBUG ( 940): a6d8014c b43c3f03 /system/lib/libart.so (std::__1::basic_ostream >& std::__1::operator<< >(std::__1::basic_ostream >&, char const*)+611) I/DEBUG ( 940): ........ ........ I/DEBUG ( 940): #02 a6d801d0 a6d80310 [stack:15623] I/DEBUG ( 940): a6d801d4 b463bcc0 /system/lib/libart.so (art::StackDumpVisitor::DumpLockedObject(art::mirror::Object*, void*)) I/DEBUG ( 940): a6d801d8 b8fcf140 [heap] I/DEBUG ( 940): a6d801dc b4716b48 /system/lib/libart.so (art::x86::X86Context::FillCalleeSaves(art::StackVisitor const&)+168) I/DEBUG ( 940): a6d801e0 000001e0 I/DEBUG ( 940): a6d801e4 706ce128 /system/framework/x86/boot.art I/DEBUG ( 940): a6d801e8 0000051d I/DEBUG ( 940): a6d801ec 0000051d I/DEBUG ( 940): a6d801f0 00000041 I/DEBUG ( 940): a6d801f4 00000028 I/DEBUG ( 940): a6d801f8 b8e71af0 [heap] I/DEBUG ( 940): a6d801fc e90c383e I/DEBUG ( 940): a6d80200 b8da5430 [heap] I/DEBUG ( 940): a6d80204 b47310c8 /system/lib/libart.so I/DEBUG ( 940): a6d80208 a6d80230 [stack:15623] I/DEBUG ( 940): a6d8020c b47b2cf8 /system/lib/libart.so I/DEBUG ( 940): ........ ........ I/DEBUG ( 940): I/DEBUG ( 940): memory map around fault addr 006e009d: I/DEBUG ( 940): (no map below) I/DEBUG ( 940): (no map for address) I/DEBUG ( 940): (no map above) I/am_crash( 1280): [1280,0,com.appcelerator.kitchensink,11058756,Native crash,Segmentation fault,unknown,0] I/BootReceiver( 1280): Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE) W/ActivityManager( 1280): Process com.appcelerator.kitchensink has crashed too many times: killing! {code} 2. After fixing the above ART runtime issue, on device (when backing out of the test), the app crashes with the following error {code} 08-21 15:38:20.384: E/TiApplication(10480): (main) [0,199305] Sending event: exception on thread: main msg:java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.kitchen/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference; Titanium 1.0,N/A,N/A 08-21 15:38:20.384: E/TiApplication(10480): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.kitchen/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference 08-21 15:38:20.384: E/TiApplication(10480): at android.app.ActivityThread.deliverResults(ActivityThread.java:3426) 08-21 15:38:20.384: E/TiApplication(10480): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3469) 08-21 15:38:20.384: E/TiApplication(10480): at android.app.ActivityThread.access$1300(ActivityThread.java:143) 08-21 15:38:20.384: E/TiApplication(10480): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305) 08-21 15:38:20.384: E/TiApplication(10480): at android.os.Handler.dispatchMessage(Handler.java:102) 08-21 15:38:20.384: E/TiApplication(10480): at android.os.Looper.loop(Looper.java:135) 08-21 15:38:20.384: E/TiApplication(10480): at android.app.ActivityThread.main(ActivityThread.java:5070) 08-21 15:38:20.384: E/TiApplication(10480): at java.lang.reflect.Method.invoke(Native Method) 08-21 15:38:20.384: E/TiApplication(10480): at java.lang.reflect.Method.invoke(Method.java:372) 08-21 15:38:20.384: E/TiApplication(10480): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836) 08-21 15:38:20.384: E/TiApplication(10480): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631) 08-21 15:38:20.384: E/TiApplication(10480): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference 08-21 15:38:20.384: E/TiApplication(10480): at org.appcelerator.titanium.io.TiFileFactory.createTitaniumFile(TiFileFactory.java:56) 08-21 15:38:20.384: E/TiApplication(10480): at ti.modules.titanium.media.MediaModule.createDictForImage(MediaModule.java:823) 08-21 15:38:20.384: E/TiApplication(10480): at ti.modules.titanium.media.MediaModule$1.onResult(MediaModule.java:794) 08-21 15:38:20.384: E/TiApplication(10480): at org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:58) 08-21 15:38:20.384: E/TiApplication(10480): at org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:107) 08-21 15:38:20.384: E/TiApplication(10480): at org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:632) 08-21 15:38:20.384: E/TiApplication(10480): at android.app.Activity.dispatchActivityResult(Activity.java:5922) 08-21 15:38:20.384: E/TiApplication(10480): at android.app.ActivityThread.deliverResults(ActivityThread.java:3422) 08-21 15:38:20.384: E/TiApplication(10480): ... 10 more 08-21 15:38:20.460: E/AndroidRuntime(10480): FATAL EXCEPTION: main 08-21 15:38:20.460: E/AndroidRuntime(10480): Process: com.kitchen, PID: 10480 08-21 15:38:20.460: E/AndroidRuntime(10480): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.kitchen/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference 08-21 15:38:20.460: E/AndroidRuntime(10480): at android.app.ActivityThread.deliverResults(ActivityThread.java:3426) 08-21 15:38:20.460: E/AndroidRuntime(10480): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3469) 08-21 15:38:20.460: E/AndroidRuntime(10480): at android.app.ActivityThread.access$1300(ActivityThread.java:143) 08-21 15:38:20.460: E/AndroidRuntime(10480): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305) 08-21 15:38:20.460: E/AndroidRuntime(10480): at android.os.Handler.dispatchMessage(Handler.java:102) 08-21 15:38:20.460: E/AndroidRuntime(10480): at android.os.Looper.loop(Looper.java:135) 08-21 15:38:20.460: E/AndroidRuntime(10480): at android.app.ActivityThread.main(ActivityThread.java:5070) 08-21 15:38:20.460: E/AndroidRuntime(10480): at java.lang.reflect.Method.invoke(Native Method) 08-21 15:38:20.460: E/AndroidRuntime(10480): at java.lang.reflect.Method.invoke(Method.java:372) 08-21 15:38:20.460: E/AndroidRuntime(10480): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836) 08-21 15:38:20.460: E/AndroidRuntime(10480): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631) 08-21 15:38:20.460: E/AndroidRuntime(10480): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference 08-21 15:38:20.460: E/AndroidRuntime(10480): at org.appcelerator.titanium.io.TiFileFactory.createTitaniumFile(TiFileFactory.java:56) 08-21 15:38:20.460: E/AndroidRuntime(10480): at ti.modules.titanium.media.MediaModule.createDictForImage(MediaModule.java:823) 08-21 15:38:20.460: E/AndroidRuntime(10480): at ti.modules.titanium.media.MediaModule$1.onResult(MediaModule.java:794) 08-21 15:38:20.460: E/AndroidRuntime(10480): at org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:58) 08-21 15:38:20.460: E/AndroidRuntime(10480): at org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:107) 08-21 15:38:20.460: E/AndroidRuntime(10480): at org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:632) 08-21 15:38:20.460: E/AndroidRuntime(10480): at android.app.Activity.dispatchActivityResult(Activity.java:5922) 08-21 15:38:20.460: ...
Story points: 3