{ "id": "160738", "key": "TIMOB-23473", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-03-07T14:28:27.000+0000", "created": "2016-06-03T02:47:22.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "17993", "description": "Release 5.2.2", "name": "Release 5.2.2", "archived": false, "released": true, "releaseDate": "2016-04-05" } ], "issuelinks": [ { "id": "51941", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "159651", "key": "TIMOB-23230", "fields": { "summary": "iOS,Android: An event for the camera has been opened successfully.", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-07T22:26:07.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Resolving TIMOB-23230 brought attention to this error. Logs as follows:-\r\n{code}\r\nERROR] : TiBlob: (main) [449,5770] null\r\n[ERROR] : TiBlob: java.io.IOException\r\n[ERROR] : TiBlob: \tat java.io.InputStream.reset(InputStream.java:208)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.guessAdditionalContentTypeFromStream(TiBlob.java:239)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:214)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:270)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:140)\r\n[ERROR] : TiBlob: \tat org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:113)\r\n[ERROR] : TiBlob: \tat ti.modules.titanium.media.TiCameraActivity$3.onPictureTaken(TiCameraActivity.java:563)\r\n[ERROR] : TiBlob: \tat android.hardware.Camera$EventHandler.handleMessage(Camera.java:1092)\r\n[ERROR] : TiBlob: \tat android.os.Handler.dispatchMessage(Handler.java:102)\r\n[ERROR] : TiBlob: \tat android.os.Looper.loop(Looper.java:148)\r\n[ERROR] : TiBlob: \tat android.app.ActivityThread.main(ActivityThread.java:5417)\r\n[ERROR] : TiBlob: \tat java.lang.reflect.Method.invoke(Native Method)\r\n[ERROR] : TiBlob: \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\r\n[ERROR] : TiBlob: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\r\n{code}\r\nThis was tested on an Android 6.0, Nexus 6.\r\n\r\nTest code as follows:-\r\n{code}\r\n\r\nvar window = Ti.UI.createWindow();\r\nvar overlay = Ti.UI.createView();\r\nvar button = Titanium.UI.createButton({\r\n color : '#fff',\r\n bottom : \"10dp\",\r\n width : \"130dp\",\r\n height : \"50dp\",\r\n font : {\r\n fontSize : \"14dp\",\r\n fontWeight : 'bold',\r\n fontFamily : 'Helvetica Neue'\r\n },\r\n title : 'Take Picture'\r\n});\r\n \r\nbutton.addEventListener('click', function() {\r\n Ti.Media.takePicture();\r\n});\r\n \r\nwindow.add(overlay);\r\noverlay.add(button);\r\nwindow.addEventListener('open', function(e){\r\n var cameraPermission = \"android.permission.CAMERA\";\r\n var storagePermission = \"android.permission.READ_EXTERNAL_STORAGE\";\r\n var hasCameraPerm = Ti.Android.hasPermission(cameraPermission);\r\n var hasStoragePerm = Ti.Android.hasPermission(storagePermission);\r\n var permissionsToRequest = [];\r\n if (!hasCameraPerm) {\r\n permissionsToRequest.push(cameraPermission);\r\n }\r\n if (!hasStoragePerm) {\r\n permissionsToRequest.push(storagePermission);\r\n }\r\n if (permissionsToRequest.length > 0) {\r\n Ti.Android.requestPermissions(permissionsToRequest, function(e) {\r\n if (e.success) {\r\n showCamera();\r\n } else {\r\n Ti.API.info(\"ERROR: \" + e.error);\r\n }\r\n });\r\n } else {\r\n showCamera();\r\n }\r\n});\r\nTi.Media.addEventListener('cameraready', function(e){\r\n Ti.Media.takePicture();\r\n});\r\nvar container = Ti.UI.createView({\r\n top:'10%',\r\n height:'80%'\r\n });\r\n \r\nvar img = Ti.UI.createImageView({\r\n });\r\n \r\ncontainer.add(img);\r\nwindow.add(container);\r\nwindow.open();\r\n \r\nfunction showCamera() {\r\n Ti.Media.showCamera({\r\n success : function(e) {\r\n Ti.API.info('GOT SUCCESS CALLBACK');\r\n var imgWid = e.media.width;\r\n var imgHeight = e.media.height;\r\n var mSize = container.size;\r\n var mW = mSize.width;\r\n var mH = mSize.height;\r\n \r\n var wS = imgWid/mW;\r\n var hS = imgHeight/mH;\r\n var tS = (wS < hS) ? wS : hS;\r\n \r\n var dstWid = imgWid/tS;\r\n var dstHeight = imgHeight/ tS;\r\n \r\n Ti.API.info(imgWid+' '+imgHeight+' '+mW+' '+mH+' '+wS+' '+hS+' '+tS+' '+dstWid+' '+dstHeight);\r\n var resize = e.media.imageAsResized(dstWid,dstHeight);\r\n img.image = resize;\r\n },\r\n overlay : overlay,\r\n mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],\r\n saveToPhotoGallery : true\r\n });\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: Getting an error in the logs when using the Camera (Regression)", "creator": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "subtasks": [], "reporter": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "environment": null, "closedSprints": [ { "id": 847, "state": "closed", "name": "2017 Sprint 05 SDK", "startDate": "2017-02-26T17:39:21.095Z", "endDate": "2017-03-12T17:39:00.000Z", "completeDate": "2017-03-12T19:14:38.838Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "407304", "author": { "name": "awaldman", "key": "awaldman", "displayName": "Andy Waldman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I cant seem to reproduce the error specified above running in the same environment ", "updateAuthor": { "name": "awaldman", "key": "awaldman", "displayName": "Andy Waldman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-02-17T17:17:23.000+0000", "updated": "2017-02-21T22:47:45.000+0000" }, { "id": "407515", "author": { "name": "fmerzadyan", "key": "fmerzadyan2", "displayName": "Frankie Merzadyan", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Test case does not reproduce errors in logs like reported when run using Studio/Appc CLI. Ran on Samsung S6 Galaxy using latest SDK. App does not run when run natively in IntelliJ, TiActivity is not written into AndroidManifest but that is because it is not built and packaged like in running titanium apps using AppC CLI.", "updateAuthor": { "name": "fmerzadyan", "key": "fmerzadyan2", "displayName": "Frankie Merzadyan", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-02-21T22:48:01.000+0000", "updated": "2017-02-21T22:48:01.000+0000" }, { "id": "409305", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~gmathews] Hey man! Is this fixed with our most recent Android camera fixes?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-03-06T14:31:38.000+0000", "updated": "2017-03-06T14:31:48.000+0000" }, { "id": "409499", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I also cannot reproduce the error, there have been changes since this was reported which may have fixed this issue.\r\n\r\nClosing as invalid.", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-07T14:28:27.000+0000", "updated": "2017-03-07T14:28:27.000+0000" }, { "id": "409664", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as it is marked as invalid. ", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-07T22:25:59.000+0000", "updated": "2017-03-07T22:25:59.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }