[TIMOB-14211] Android: Photo deleted on Xperia Arc (lt15i)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 3.1.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android |
Reporter | Antoine Joulie |
Assignee | Unknown |
Created | 2013-05-03T15:56:00.000+0000 |
Updated | 2018-02-28T20:03:26.000+0000 |
Description
Desc : On an xperia arc, sometimes photos are not present into device and log show a FileNotFoundException on MediaModule#createDictForImage (when calling TiBlob.blobFromFile). This does not all the time, but something like 1 time every 5 times.
Here is an app.js that reproduce the bug (notice that savePhotoToGallery is false)
*Test case*
// app.js
//
function showCamera() {
Ti.Media.showCamera({
success: function(e) {alert('image ok, width ' + e.media.width);},
cancel: function() {alert('cancel');},
error: function() {alert('error');},
showControls: true, // show the controls in the bottom
saveToPhotoGallery: false, // true if you want to save the photo taken in the gallery
autohide: false, // let the app decide when to close the camera
allowImageEditing: false // ?
});
}
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var button = Titanium.UI.createButton({
color:'#999',
title:'Click me',
font:{fontSize:40,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'100',
});
button.addEventListener('click', function() {
showCamera();
});
win1.add(button);
// open tab group
win1.open();
Problem : On file MediaModule.java into onResult method, the cursor returns a image which is already saved into my application bucket.
Then later in the code, function moveImage is called with the same value for source and destination, leading to the deletion of the image.
I quick fixed the problem by adding following code at the beginning of method MediaModule#moveImage.
*MediaModule.java*
if (source == dest) {
Log.e(TAG, "source (" +source + ") eq to dest (" + dest + "). Not moving file", Log.DEBUG_MODE);
return;
}
Didn't have Xperia Arc device but tried on Xperia(st25i) running 2.3.7 & could not reproduce the issue. Ran an app created using the code above, 5-10 times, every time pic was taken successfully & I did not get any errors. Environment: Appc Studio : 3.2.3.201404111117 Ti SDK : 3.2.3.v20140403105720 Mac OSX : 10.8.5 Alloy : 1.3.1 CLI - 3.2.3-alpha2 Xperia running android 2.3.7