[TIMOB-28193] Android: Selecting multiple photos/videos via openPhotoGallery() can cause a crash as of 9.1.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-10-27T21:19:03.000+0000 |
Affected Version/s | Release 9.1.0 |
Fix Version/s | Release 9.3.0, Release 9.2.2 |
Components | Android |
Labels | android, media, photo, photogallery, regression, video |
Reporter | Lokesh Choudhary |
Assignee | Joshua Quick |
Created | 2020-10-13T22:29:16.000+0000 |
Updated | 2020-10-27T21:19:03.000+0000 |
Description
This is a regression. Broken since 9.1.0.GA.
Issue is seen only when multiple photos are selected. Selecting multiple photos from google photos does not cause this issue.
Steps to reproduce:
1. Use the code below in the app.js:
layout: 'vertical',
backgroundColor: 'gray'
});
galleryBtn = Ti.UI.createButton({
title: 'Open Gallery'
});
galleryBtn.addEventListener('click', () => {
Ti.Media.openPhotoGallery({
allowMultiple: true,
error: function(e){
Ti.API.error(e);
},
success: function(e){
Ti.API.info(e);
}
});
});
win.add([galleryBtn]);
win.open();
2. After the app launches click open gallery
.
3. Select multiple photos from the gallery & click open/select.
Actual result:
1. The app crashes with error:
[ERROR] : TiExceptionHandler: (main) [4,18345] Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { flg=0x1 clip={image/* U:content://com.android.providers.media.documents/document/image%3A25876 ...} }} to activity {com.app.zzzz/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference
[ERROR] : TiExceptionHandler:
[ERROR] : TiExceptionHandler: ti.modules.titanium.media.MediaModule$1.onResult(MediaModule.java:973)
[ERROR] : TiExceptionHandler: org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:60)
[ERROR] : TiExceptionHandler: org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:117)
[ERROR] : TiExceptionHandler: org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:900)
[ERROR] : TiExceptionHandler: android.app.Activity.dispatchActivityResult(Activity.java:7759)
[ERROR] : TiExceptionHandler: android.app.ActivityThread.deliverResults(ActivityThread.java:4626)
[ERROR] : TiExceptionHandler: android.app.ActivityThread.handleSendResult(ActivityThread.java:4675)
[ERROR] : TiExceptionHandler: android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
[ERROR] : TiExceptionHandler: android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
[ERROR] : TiExceptionHandler: android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
[ERROR] : TiExceptionHandler: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1950)
[ERROR] : TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:106)
[ERROR] : TiExceptionHandler: android.os.Looper.loop(Looper.java:214)
[ERROR] : TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:7073)
[ERROR] : TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method)
[ERROR] : TiExceptionHandler: com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
[ERROR] : TiExceptionHandler: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
Expected result:
1. The app should not crash.Attachments
File | Date | Size |
---|---|---|
PhotoVideoMultiselectTest.js | 2020-10-23T21:46:20.000+0000 | 3344 |
This is the same issue as [TIMOB-28178], just a different way of reproducing it.
Problem still exists, tested with: SDK: 9.3.0.v20201021081529 Device: Samsung Galaxy Note9 (SM-N9600) Android Version: 10
PR (master): https://github.com/appcelerator/titanium_mobile/pull/12212
merged to master for 9.3.0 target. Backport PR for 9_2_X required some manual adjustment, but is merged for 9.2.2 target.
Thank you very much for the very quick turnaround :) Tested (9.3.0.v20201026143050), Works!
Verified the fix with SDK 9.3.0.v20201027120230. Closing.