[
https://issues.apache.org/jira/browse/CB-11034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15230306#comment-15230306
]
ASF GitHub Bot commented on CB-11034:
-------------------------------------
GitHub user elsewhat opened a pull request:
https://github.com/apache/cordova-plugin-camera/pull/201
CB-11034: Camera.getPicture -Handle of OutOfMemoryError gracefull
Catch OutOfMemoryError for memory intensive operations and handle them
gracefully.
Tested on a Samsung SII which throws OutOfMemoryException when taking a
photo and fetching it as a DATA_URL.Not able to test when selecting from gallery
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/elsewhat/cordova-plugin-camera
CB-11034cordova-plugin-camera
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-plugin-camera/pull/201.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #201
----
commit eb3ecfff3e07b0e4dd0f6d9b723518d52962f36c
Author: Dagfinn Parnas <[email protected]>
Date: 2016-04-07T14:16:55Z
CB-11034: Camera.getPicture -Handle of OutOfMemoryError gracefull
Catch OutOfMemoryError for memory intensive operations and handle them
gracefully
----
> Camera.getPicture -Handle of OutOfMemoryError gracefully
> --------------------------------------------------------
>
> Key: CB-11034
> URL: https://issues.apache.org/jira/browse/CB-11034
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Camera
> Affects Versions: 2.1.1
> Environment: Android
> Reporter: Dagfinn Parnas
>
> We have an app for which we are dependent on using DATA_URL.
> On some older phones (Samsung SII Android 4.1), we have experienced sporadic
> OutOfMemoryError exceptions when taking a picture.
> When this occurs the app crashes since the camera plugin doesn't explicitly
> handle the java.lang.OutOfMemoryError which is thrown.
> It's ok that the OutOfMemoryError appear, but the apps should be able to
> handle it gracefully and not just have the app crash.
> Example stack trace from an uncaught OutOfMemoryError
> {code}
> 04-06 09:51:55.155: E/dalvikvm-heap(22744): Out of memory on a 31961104-byte
> allocation.
> 04-06 09:51:55.155: I/dalvikvm(22744): at
> android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
> 04-06 09:51:55.160: I/dalvikvm(22744): at
> android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:652)
> 04-06 09:51:55.160: I/dalvikvm(22744): at
> android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:724)
> 04-06 09:51:55.160: I/dalvikvm(22744): at
> org.apache.cordova.camera.CameraLauncher.getScaledBitmap(CameraLauncher.java:916)
> 04-06 09:51:55.160: I/dalvikvm(22744): at
> org.apache.cordova.camera.CameraLauncher.processResultFromCamera(CameraLauncher.java:454)
> 04-06 09:51:55.160: I/dalvikvm(22744): at
> org.apache.cordova.camera.CameraLauncher.onActivityResult(CameraLauncher.java:753)
> 04-06 09:51:55.160: I/dalvikvm(22744): at
> org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:120)
> {code}
> In the example above, CameraLauncher.getScaledBitmap doesn't catch the
> java.lang.OutOfMemoryError and the app crashes. The same situation can occur
> in CameraLauncher.processPicture (which has a try catch with only exception)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]