[TIMOB-7716] Android: Taking a picture crashes the app on a Samsung Galaxy S2
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2012-03-10T23:44:17.000+0000 |
| Affected Version/s | Release 1.8.0.1, Release 2.0.0 |
| Fix Version/s | Sprint 2012-05, Release 2.0.0 |
| Components | Android |
| Labels | module_media, qe-testadded |
| Reporter | Junaid Younus |
| Assignee | Josh Roesslein |
| Created | 2012-02-17T16:50:05.000+0000 |
| Updated | 2012-07-05T15:50:31.000+0000 |
Description
*The code*
Kitchen Sink from GitHub.
*Expected behavior*
When you navigate to 'Phone->Camera->Camera Basic' and then take a picture, it shouldn't crash.
*Actual behavior*
When you follow the steps above, it crashes the app.
*Other info*
-Same result with the following TiSDKs: 1.8.2.v20120217114657 and 2.0.0v20120217094635
-It doesn't matter if there is an SD card inserted or not, it crashes either way.
Also seems to happen on a Samsung Exhibit 4G.
NOTE: You have to push 'save' after taking the picture to cause KS to crash.
Testing code:
Testing steps: 1. Run the above code on galaxy S2 with / without "saveToPhotoGallery:true". 2. Click the button 3. Take a picture and click 'save' Expected result: With "saveToPhotoGallery:true", the picture should be in Gallery/Camera folder. Without "saveToPhotoGallery:true", the picture should be in Gallery/(Your application name) folder.var win = Ti.UI.createWindow({ backgroundColor : '#eee' }); var showCameraButton = Ti.UI.createButton({ title : 'Open Camera', width : 200, height : 70, bottom : 5 }); showCameraButton.addEventListener('click', function() { Ti.Media.showCamera({ success : function(e) {}, mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]//, //saveToPhotoGallery: true }); }); win.add(showCameraButton); win.open();Reopened this ticket since it now crashes on other Android devices. Here is the crash log:
It crashes when you take a picture in kitchen sink. Tried it using the latest 2.0.0 CI build. This problem now occurs on a Samsung Exhibit 4G and a Droid Bionic. They both are running Android 2.3.x. If there's any other information you need from me, please let me know ASAP. Thanks.I/PowerManagerService( 137): Light Animator Finished curIntValue=87 I/InputReader( 137): dispatchTouch::touch event's action is 0 I/InputDispatcher( 137): Delivering touch to current input target: action: 0, channel '4093e030 com.sec.android.app.camera/com.sec.android.app.camera.CropImage (server)' I/InputReader( 137): dispatchTouch::touch event's action is 1 I/InputDispatcher( 137): Delivering touch to current input target: action: 1, channel '4093e030 com.sec.android.app.camera/com.sec.android.app.camera.CropImage (server)' V/CropImage( 1287): onSaveClicked V/CropImage( 1287): Crop = no, Return = specified uri V/CropImage( 1287): onPause V/Camera ( 1249): --onActivityResult--requestCode: 2001 V/Camera ( 1249): --onActivityResult--resultCode: -1 V/Camera ( 1249): --onActivityResult--data: Intent { act=inline-data (has extras) } W/ActivityManager( 137): Duplicate finish request for HistoryRecord{408ec038 com.sec.android.app.camera/.Camera} V/MediaProvider( 930): requestMediaThumbnail: this file must not be requested thumbnail. - path = /sdcard/dcim/Camera/tia264767409.jpg, uri =content://media/external/images/media/258 D/AndroidRuntime( 1061): Shutting down VM W/dalvikvm( 1061): threadid=1: thread exiting with uncaught exception (group=0x40015578) E/TiApplication( 1061): (main) [10882,379591] Sending event: exception on thread: main msg:java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {com.appcelerator.titanium/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException; Titanium 2.0.0,2012/02/27 20:01,88ae7af E/TiApplication( 1061): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {com.appcelerator.titanium/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException E/TiApplication( 1061): at android.app.ActivityThread.deliverResults(ActivityThread.java:2536) E/TiApplication( 1061): at android.app.ActivityThread.handleSendResult(ActivityThread.java:2578) E/TiApplication( 1061): at android.app.ActivityThread.access$2000(ActivityThread.java:117) E/TiApplication( 1061): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:965) E/TiApplication( 1061): at android.os.Handler.dispatchMessage(Handler.java:99) E/TiApplication( 1061): at android.os.Looper.loop(Looper.java:123) E/TiApplication( 1061): at android.app.ActivityThread.main(ActivityThread.java:3687) E/TiApplication( 1061): at java.lang.reflect.Method.invokeNative(Native Method) E/TiApplication( 1061): at java.lang.reflect.Method.invoke(Method.java:507) E/TiApplication( 1061): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) E/TiApplication( 1061): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) E/TiApplication( 1061): at dalvik.system.NativeStart.main(Native Method) E/TiApplication( 1061): Caused by: java.lang.NullPointerException E/TiApplication( 1061): at ti.modules.titanium.media.MediaModule.createDictForImage(MediaModule.java:557) E/TiApplication( 1061): at ti.modules.titanium.media.MediaModule$CameraResultHandler.onResult(MediaModule.java:314) E/TiApplication( 1061): at org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:51) E/TiApplication( 1061): at org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:67) E/TiApplication( 1061): at org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:459) E/TiApplication( 1061): at android.app.Activity.dispatchActivityResult(Activity.java:3908) E/TiApplication( 1061): at android.app.ActivityThread.deliverResults(ActivityThread.java:2532) E/TiApplication( 1061): ... 11 more E/AndroidRuntime( 1061): FATAL EXCEPTION: main E/AndroidRuntime( 1061): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {com.appcelerator.titanium/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException E/AndroidRuntime( 1061): at android.app.ActivityThread.deliverResults(ActivityThread.java:2536) E/AndroidRuntime( 1061): at android.app.ActivityThread.handleSendResult(ActivityThread.java:2578) E/AndroidRuntime( 1061): at android.app.ActivityThread.access$2000(ActivityThread.java:117) E/AndroidRuntime( 1061): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:965) E/AndroidRuntime( 1061): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 1061): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 1061): at android.app.ActivityThread.main(ActivityThread.java:3687) E/AndroidRuntime( 1061): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 1061): at java.lang.reflect.Method.invoke(Method.java:507) E/AndroidRuntime( 1061): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) E/AndroidRuntime( 1061): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) E/AndroidRuntime( 1061): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 1061): Caused by: java.lang.NullPointerException E/AndroidRuntime( 1061): at ti.modules.titanium.media.MediaModule.createDictForImage(MediaModule.java:557) E/AndroidRuntime( 1061): at ti.modules.titanium.media.MediaModule$CameraResultHandler.onResult(MediaModule.java:314) E/AndroidRuntime( 1061): at org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:51) E/AndroidRuntime( 1061): at org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:67) E/AndroidRuntime( 1061): at org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:459) E/AndroidRuntime( 1061): at android.app.Activity.dispatchActivityResult(Activity.java:3908) E/AndroidRuntime( 1061): at android.app.ActivityThread.deliverResults(ActivityThread.java:2532) E/AndroidRuntime( 1061): ... 11 more W/ActivityManager( 137): Force finishing activity com.appcelerator.titanium/org.appcelerator.titanium.TiActivity E/ ( 137): Dumpstate > /data/log/dumpstate_app_error D/PowerManagerService( 137): onSensorChanged: light value: 9000 I/dumpstate( 1298): begin W/ActivityManager( 137): Activity pause timeout for HistoryRecord{408c7e68 com.appcelerator.titanium/org.appcelerator.titanium.TiActivity} D/AudioHardwareALSA( 86): Inside AudioStreamOutALSA::standby V/AudioHardwareALSA( 86): ALSAStreamOps::close() I/AudioHardwareALSA( 86): Output standby called!!. Turn off PCM device. D/VoldCmdListener( 78): asec list W/PowerManagerService( 137): Timer 0x7->0x3|0x0 I/PowerManagerService( 137): Ulight 7->3|0 D/LightsService( 137): BUTTON : 0 I/dumpstate( 1298): doneClosed for now since we don't have a device in the office to reproduce.
Will open again once I found a device in the office.
We cannot reproduce this issue based on all the devices we have.
From the client: The Samsung Exhibit 4G worked multiple times. The Motorola Droid Bionic crashed on the first attempt. Log for Exhibit 4G: http://pastebin.com/nxsF2vGj Log for Droid Bionic: http://pastebin.com/rQVAGSBS
This might be due to getActivity() on MediaModule returning null. Cannot reproduce this issue on any of my testing devices to verify this is the cause of the bug.
This ticket was opened for Samsung Galaxy S2 and this issue has been fixed. Please open another ticket for Droid Bionic device.
Verified fixed with 2.0.0.v20120319003254 and Titanium Studio, build: 2.0.0.201203182248 on Samsung Galaxy S2. Verified with KS from master branch.