Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25056] On Android 7.0 Ti.Media.showCamera crashes after taking photo and tapping Retry or pressing back button

GitHub Issuen/a
TypeBug
PriorityCritical
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sRelease 7.0.0
ComponentsAndroid
Labelsn/a
ReporterBrian Knorr
AssigneeLokesh Choudhary
Created2017-06-20T16:36:03.000+0000
Updated2018-02-12T11:28:48.000+0000

Description

When using Ti.Media.showCamera on Android 7.0 with Ti SDK 6.1.0 the camera app will crash after the user takes a photo and either taps Retry or presses the back button. It's very easy to reproduce by running the method Ti.Media.showCamera(options). Below is the exception and seems to be caused by the new TiFileProvider [ERROR] DatabaseUtils: Writing exception to parcel [ERROR] DatabaseUtils: java.lang.UnsupportedOperationException: No external deletions [ERROR] DatabaseUtils: at org.appcelerator.titanium.io.TiFileProvider.delete(TiFileProvider.java:45) [ERROR] DatabaseUtils: at android.content.ContentProvider$Transport.delete(ContentProvider.java:344) [ERROR] DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:206) [ERROR] DatabaseUtils: at android.os.Binder.execTransact(Binder.java:573)

Comments

  1. Brian Knorr 2017-06-20

    The specific device we are seeing this issue on is Samsung S7 running Android 7.0.
  2. Brian Knorr 2017-06-20

    Here is a better stack trace: 06-20 18:03:38.643 17691 17703 E DatabaseUtils: Writing exception to parcel 06-20 18:03:38.643 17691 17703 E DatabaseUtils: java.lang.UnsupportedOperationException: No external deletions 06-20 18:03:38.643 17691 17703 E DatabaseUtils: at org.appcelerator.titanium.io.TiFileProvider.delete(TiFileProvider.java:45) 06-20 18:03:38.643 17691 17703 E DatabaseUtils: at android.content.ContentProvider$Transport.delete(ContentProvider.java:344) 06-20 18:03:38.643 17691 17703 E DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:206) 06-20 18:03:38.643 17691 17703 E DatabaseUtils: at android.os.Binder.execTransact(Binder.java:573) 06-20 18:03:38.644 18280 22759 I SA : [OCP] Cursor is not null 06-20 18:03:38.644 25323 25323 D AndroidRuntime: Shutting down VM 06-20 18:03:38.645 25323 25323 E AndroidRuntime: FATAL EXCEPTION: main 06-20 18:03:38.645 25323 25323 E AndroidRuntime: Process: com.sec.android.app.camera, PID: 25323 06-20 18:03:38.645 25323 25323 E AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2001, result=0, data=Intent { launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 }(has extras) }} to activity {com.sec.android.app.camera/com.sec.android.app.camera.Camera}: java.lang.UnsupportedOperationException: No external deletions 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4525) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4568) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.app.ActivityThread.-wrap22(ActivityThread.java) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1706) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6688) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: Caused by: java.lang.UnsupportedOperationException: No external deletions 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:167) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.content.ContentProviderProxy.delete(ContentProviderNative.java:544) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.content.ContentResolver.delete(ContentResolver.java:1377) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at com.sec.android.app.camera.Camera.onActivityResult(Camera.java:5153) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.app.Activity.dispatchActivityResult(Activity.java:7226) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4521) 06-20 18:03:38.645 25323 25323 E AndroidRuntime: ... 9 more
  3. Gary Mathews 2017-08-02

    I'm unable to reproduce using this test case:
       var win = Titanium.UI.createWindow({layout: 'vertical'}),
           openCamera = Ti.UI.createButton({title: 'OPEN CAMERA', width: Ti.UI.FILL, height: '40dp'}),
           preview = Ti.UI.createImageView({backgroundColor: 'red', height: Ti.UI.FILL, width: Ti.UI.FILL});
       
       function showCamera() {
           if (Ti.Media.hasCameraPermissions()) {
               Ti.Media.showCamera({
                   success: function(e) {
                       preview.image = e.media;
                       Ti.Media.hideCamera();
                   },
                   cancel: function() {
                       Ti.API.info('canceled');
                   },
                   error: function(e) {
                       Ti.API.info('error: ' + JSON.stringify(e, null, ' '));
                   },
                   mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO]
               });
           } else {
               Ti.Media.requestCameraPermissions(function(e) {
                   if (e.success) {
                       showCamera();
                   }
               });
           }
       }
       
       openCamera.addEventListener('click', function() {
           showCamera();
       });
       
       win.add(openCamera);
       win.add(preview);
       
       win.open();
       
    Could you provide a test case that reproduces this issue?
  4. Victor Vazquez Montero 2017-08-02

    hey [~gmathews] per customer: just generate a new Alloy project and add these lines of code in the app/controllers/index.js file:
       var showCamera = function() {
       Ti.Media.showCamera({
       mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
       success: function() {},
       cancel: function() {},
       error: function() {}
       });
       };
       
       if (Ti.Media.hasCameraPermissions()) {
       showCamera();
       } else {
       Ti.Media.requestCameraPermissions(function(result) {
       if (result.success) {
       showCamera();
       }
       });
       }
       
  5. Gary Mathews 2017-09-01

    [~vvazquezmontero] Tested the case above, I cannot reproduce the issue. Pressing Retry or navigating back works as expected.
  6. Eric Merriman 2017-09-06

    [~lchoudhary] Please try this one and see if you can reproduce.
  7. Victor Vazquez Montero 2017-09-18

    [~lchoudhary] Do we have any update on this ticket?
  8. Prashant Saini 2017-10-27

    @Lokesh Choudhary, I have also faced this error on Nokia 5 - Android OS 7.1.2 today morning. I ran many many tests but could not find anything on console. When app crashes, it doesn't even prints on console, not even in Trace Console mode. There's just nothing printed on console. As per tests I ran, I can surely say 1 thing that since I was not able to see any log on console, it's pretty much sure that no callback is called at all. neither success, nor cancel, nor error callback. I had two camera apps installed, one is device's inbuilt camera & other a 3rd party app. I noticed something very weird that after clearing the Default Camera app, showCamera() method shows a list to chose camera & if I chose camera A for very first time, app crashes even after pressing back button without capturing photo. Next time I choose Camera A again, & it doesn't crash. But if I chose Camera B after Camera A, it crashes without any callback called. So, it's sure that switching between camera apps crashes the app, be it inbuilt camera app or any other 3rd party app. You guys really need to figure this out since the camera feature is not working at all in Android 7 or +
  9. Victor Vazquez Montero 2018-02-07

    [~lchoudhary] this ticket can be closed
  10. Victor Vazquez Montero 2018-02-07

    [~lchoudhary] we are good to close original servicenow ticket is closed

JSON Source