Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 22821D686 for ; Wed, 29 Aug 2012 19:26:09 +0000 (UTC) Received: (qmail 1204 invoked by uid 500); 29 Aug 2012 19:26:08 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 1175 invoked by uid 500); 29 Aug 2012 19:26:08 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 1166 invoked by uid 99); 29 Aug 2012 19:26:08 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Aug 2012 19:26:08 +0000 Date: Thu, 30 Aug 2012 06:26:08 +1100 (NCT) From: "Brion Vibber (JIRA)" To: callback-dev@incubator.apache.org Message-ID: <1226192957.13400.1346268368845.JavaMail.jiratomcat@arcas> In-Reply-To: <52584370.10142.1346213167721.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (CB-1293) Camera.getPicture crashes when selecting from a Picasa album on Android MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13444339#comment-13444339 ] Brion Vibber commented on CB-1293: ---------------------------------- Problem seems to be that different things can store at different locations, which may not be very predictable. :( Safest thing is probably to read the file through Android's ContentResolver. FileTransfer does that like so: if (path.startsWith("content:")) { Uri uri = Uri.parse(path); return cordova.getActivity().getContentResolver().openInputStream(uri); } http://developer.android.com/reference/android/content/ContentResolver.html#openInputStream%28android.net.Uri%29 Changing CameraLauncher.getScaledBitmap to be able to take a 'content:' URI directly and do BitmapFactory.decodeStream() instead of BitmapFactory.decodeFile() might do the job. (However I'm seeing some trouble using FileTransfer.upload on the Picasa images on my phone, so .... mileage may vary. :P) > Camera.getPicture crashes when selecting from a Picasa album on Android > ----------------------------------------------------------------------- > > Key: CB-1293 > URL: https://issues.apache.org/jira/browse/CB-1293 > Project: Apache Cordova > Issue Type: Bug > Components: Android > Affects Versions: 2.0.0 > Environment: Crash found with 2.0.0 on Galaxy Nexus running Android 4.0.4 > Reporter: Brion Vibber > Assignee: Simon MacDonald > > When using camera.getPicture with options: > destinationType: Camera.DestinationType.FILE_URI, > sourceType: Camera.PictureSourceType.PHOTOLIBRARY > and selecting a photo from a Picasa-synced album, the application crashes immediately upon trying to return the data. > Here's our downstream bug with some analysis: https://bugzilla.wikimedia.org/show_bug.cgi?id=39604 > FileUtils.getRealPathFromURI() cannot read the "_data" column from the content provider database, so imagePath and bitmap in CameraLauncher.onActivityResult are null. The crash occurs when trying to run bitmap.recycle(). > I can avoid the crash by adding a guard check for bitmap != null and the content: URI is usable in the app to load the image, but doesn't appear to work with FileTransfer. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira