{ "id": "175639", "key": "TIMOB-28190", "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": [], "resolution": null, "resolutiondate": null, "created": "2020-10-13T11:30:35.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [ { "id": "21052", "description": "", "name": "Release 9.3.0", "archived": false, "released": true, "releaseDate": "2020-12-14" }, { "id": "21092", "name": "Release 9.2.1", "archived": false, "released": true, "releaseDate": "2020-10-06" } ], "issuelinks": [], "assignee": null, "updated": "2020-10-14T14:18:55.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "When selecting the image that was taken by a Ti.Media.showCamera call, the app sometimes crashes (not even always and not on all devices). Here is the stack:\r\n{code}\r\n2020-10-13 12:41:19.961 1568-2601/? W/ActivityManager: Permission Denial: opening provider org.appcelerator.titanium.io.TiFileProvider from ProcessRecord{f2b359c 20305:com.android.camera/u0a57} (pid=20305, uid=10057) that is not exported from UID 10559\r\n2020-10-13 12:41:19.967 20305-20305/? E/CAM_Camera2Module: Exception when doAttach: \r\n java.lang.SecurityException: Permission Denial: opening provider org.appcelerator.titanium.io.TiFileProvider from ProcessRecord{f2b359c 20305:com.android.camera/u0a57} (pid=20305, uid=10057) that is not exported from UID 10559\r\n at android.os.Parcel.createException(Parcel.java:2074)\r\n at android.os.Parcel.readException(Parcel.java:2042)\r\n at android.os.Parcel.readException(Parcel.java:1990)\r\n at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:5283)\r\n at android.app.ActivityThread.acquireProvider(ActivityThread.java:6723)\r\n at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2749)\r\n at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:2133)\r\n at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1520)\r\n at android.content.ContentResolver.openOutputStream(ContentResolver.java:1242)\r\n at android.content.ContentResolver.openOutputStream(ContentResolver.java:1218)\r\n at com.android.camera.module.Camera2Module.doAttach(Camera2Module.java:8)\r\n at com.android.camera.module.Camera2Module.onReviewDoneClicked(Camera2Module.java:1)\r\n at com.android.camera.fragment.FragmentBottomIntentDone.onClick(FragmentBottomIntentDone.java:4)\r\n at android.view.View.performClick(View.java:7250)\r\n at android.view.View.performClickInternal(View.java:7227)\r\n at android.view.View.access$3500(View.java:819)\r\n at android.view.View$PerformClick.run(View.java:27749)\r\n at android.os.Handler.handleCallback(Handler.java:883)\r\n at android.os.Handler.dispatchMessage(Handler.java:100)\r\n at android.os.Looper.loop(Looper.java:224)\r\n at android.app.ActivityThread.main(ActivityThread.java:7562)\r\n at java.lang.reflect.Method.invoke(Native Method)\r\n at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)\r\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)\r\n Caused by: android.os.RemoteException: Remote stack trace:\r\n at com.android.server.am.ActivityManagerService.getContentProviderImpl(ActivityManagerService.java:7182)\r\n at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:7525)\r\n at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2179)\r\n at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2799)\r\n at android.os.Binder.execTransactInternal(Binder.java:1021)\r\n{code} ", "attachment": [ { "id": "67599", "filename": "CameraPhotoExternalTest.js", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-13T23:39:30.000+0000", "size": 984, "mimeType": "application/x-javascript" }, { "id": "67600", "filename": "CameraPhotoInternalTest.js", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-14T00:03:00.000+0000", "size": 1465, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "Android: App randomly crashes when selecting the image in Ti.Media.showCamera", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "457245", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm only able to reproduce this issue by force-quitting the app while the camera displayed. Afterwards, when you take the photo, I'll get this exact same exception. This makes sense because Titanium grants the camera app temporary permission to the sandboxed file using the Titanium app's process UID, but since the app has been terminated that process UID is no longer valid. Subsequent launches of the app use a new process UID.\r\n\r\nSo, I'm thinking the Android OS is running low on memory and is force-quitting the Titanium app once the camera app is displayed. That would explain why this happens randomly. Looking at the {{adb logcat}} should reveal this.\r\n\r\nIn Titanium, we \"could\" add intent [FLAG_GRANT_PERSISTABLE_URI_PERMISSION|https://developer.android.com/reference/android/content/Intent#FLAG_GRANT_PERSISTABLE_URI_PERMISSION] to our code [here|https://github.com/appcelerator/titanium_mobile/blob/9137732c31d9c52f97fc88ed4f7f681a70f25b9d/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java#L307] which \"might\" avoid the security exception, but there will still be an issue where the Titanium app will effectively be restarted (because it was force-quit) and you'll not receive the photo because of this. So, ultimately this wouldn't solve anything.\r\n_(Normally, Android would temporarily destroy the Titanium app's activity windows instead of killing the app process and then restore the activity windows when returning from the camera. This doesn't appear to be happening in your case.)_\r\n\r\nThe only work-arounds I can think of are:\r\n* Reduce the memory footprint of the app. Particularly if a window is displaying full sized photos.\r\n* Use the {{showCamera()}} method's \"overlay\" property which display a camera in-app as show in [^CameraPhotoInternalTest.js] .\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-10-14T00:13:27.000+0000", "updated": "2020-10-14T00:13:27.000+0000" }, { "id": "457246", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Unfortunately this is not satisfying for us. We have to indicators that point to an issue in the SDK instead of the app itself:\r\n# The app did not crash in earlier Titanium releases (SDK 8.x)\r\n# The camera (Android Camera2 API) works when built in a native app (which likely has a lighter footprint, I agree)\r\n\r\nWe will now try to replace the Ti.Media.showCamera() call with another native library (either CameraKit or the JetPack CameraX API - which Titanium should use anyways btw). It's sad to see there is nothing else to be done here.\r\n\r\n*EDIT*: The overlay workaround worked for us. There are no crashes remaining. It again indicates an issue with the SDK, but we are at least unblocked. Thank you for the hints Josh!\r\n\r\n*EDIT 2: This causes another blocker (TIMOB-28194), which may be easier to resolve than this one!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-10-14T08:52:44.000+0000", "updated": "2020-10-14T14:18:55.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }